package com.Endurancer.manager.service.impl;

import java.util.List;
import com.Endurancer.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.Endurancer.manager.mapper.BlogRelationsMapper;
import com.Endurancer.manager.domain.BlogRelations;
import com.Endurancer.manager.service.IBlogRelationsService;

/**
 * 博客文章与标签关联Service业务层处理
 * 
 * @author Endurancer
 * @date 2025-02-02
 */
@Service
public class BlogRelationsServiceImpl implements IBlogRelationsService 
{
    @Autowired
    private BlogRelationsMapper blogRelationsMapper;

    /**
     * 查询博客文章与标签关联
     * 
     * @param relationId 博客文章与标签关联主键
     * @return 博客文章与标签关联
     */
    @Override
    public BlogRelations selectBlogRelationsByRelationId(Long relationId)
    {
        return blogRelationsMapper.selectBlogRelationsByRelationId(relationId);
    }

    /**
     * 查询博客文章与标签关联列表
     * 
     * @param blogRelations 博客文章与标签关联
     * @return 博客文章与标签关联
     */
    @Override
    public List<BlogRelations> selectBlogRelationsList(BlogRelations blogRelations)
    {
        return blogRelationsMapper.selectBlogRelationsList(blogRelations);
    }

    /**
     * 新增博客文章与标签关联
     * 
     * @param blogRelations 博客文章与标签关联
     * @return 结果
     */
    @Override
    public int insertBlogRelations(BlogRelations blogRelations)
    {
        blogRelations.setCreateTime(DateUtils.getNowDate());
        return blogRelationsMapper.insertBlogRelations(blogRelations);
    }

    /**
     * 修改博客文章与标签关联
     * 
     * @param blogRelations 博客文章与标签关联
     * @return 结果
     */
    @Override
    public int updateBlogRelations(BlogRelations blogRelations)
    {
        blogRelations.setUpdateTime(DateUtils.getNowDate());
        return blogRelationsMapper.updateBlogRelations(blogRelations);
    }

    /**
     * 批量删除博客文章与标签关联
     * 
     * @param relationIds 需要删除的博客文章与标签关联主键
     * @return 结果
     */
    @Override
    public int deleteBlogRelationsByRelationIds(Long[] relationIds)
    {
        return blogRelationsMapper.deleteBlogRelationsByRelationIds(relationIds);
    }

    /**
     * 删除博客文章与标签关联信息
     * 
     * @param relationId 博客文章与标签关联主键
     * @return 结果
     */
    @Override
    public int deleteBlogRelationsByRelationId(Long relationId)
    {
        return blogRelationsMapper.deleteBlogRelationsByRelationId(relationId);
    }
}
